package nl.runnable.solr.xslt.client;

import java.io.InputStream;

import org.springframework.util.Assert;

/**
 * {@link XmlContent} implementation that uses an existing {@link InputStream} to provide content.
 * 
 * @author Laurens Fridael
 * 
 */
public class StreamXmlContent extends XmlContent {

	private final InputStream content;

	public StreamXmlContent(final InputStream content, final String mimeType, final String encoding) {
		super(mimeType, encoding);
		Assert.notNull(content, "Content cannot be null.");
		this.content = content;
	}

	public StreamXmlContent(final InputStream content) {
		this(content, "utf-8", null);
	}

	@Override
	public InputStream getContentAsStream() {
		return content;
	}

}
